package com.acme.task1;

public class Calculator {
	/**
	 * This class Calculator performs four arithmetic operations
	 */
	public static void main(String[] args) {

		if (args.length == 3) {
			double rezult = 0;
			double operand1 = 0;
			boolean proverka = true;
			double operand2 = 0;

			char operacia = args[1].charAt(0);
			try {
				operand1 = Double.parseDouble(args[0]);
				operand2 = Double.parseDouble(args[2]);
			} catch (NumberFormatException ne) {
				System.out.println("This is not a number!");
				proverka = false;

			}

			if (proverka) {
				switch (operacia) {
				case '+': {

					rezult = operand1 + operand2;
					System.out.println(rezult);
					break;
				}
				case '-': {

					rezult = operand1 - operand2;
					System.out.println(rezult);
					break;
				}
				case ':':
				case '\\':
				case '/': {

					rezult = operand1 / operand2;
					System.out.println(rezult);
					break;
				}

				case 'x':
				case 'X': {

					rezult = operand1 * operand2;
					System.out.println(rezult);

					break;
				}
				default: {

					System.out.println("Incorrect operation!");
				}
				}

			} else {
				System.out.println("invalid input data!");
			}
		}

	}
}
